package order

import (
	"gitee.com/cuishaop/gogin/internal/pkg/core"
	"gitee.com/cuishaop/gogin/internal/repository/sqlite"
	"gitee.com/cuishaop/gogin/internal/repository/sqlite/authorized"
)

func (s *service) PageListCount(ctx core.Context, searchData *SearchData) (total int64, err error) {
	qb := authorized.NewQueryBuilder()
	qb = qb.WhereIsDeleted(sqlite.EqualPredicate, -1)

	// if searchData.BusinessKey != "" {
	// 	qb.WhereBusinessKey(sqlite.EqualPredicate, searchData.BusinessKey)
	// }

	// if searchData.BusinessSecret != "" {
	// 	qb.WhereBusinessSecret(sqlite.EqualPredicate, searchData.BusinessSecret)
	// }

	// if searchData.BusinessDeveloper != "" {
	// 	qb.WhereBusinessDeveloper(sqlite.EqualPredicate, searchData.BusinessDeveloper)
	// }

	total, err = qb.Count(s.db.GetDbR().WithContext(ctx.RequestContext()))
	if err != nil {
		return 0, err
	}

	return
}
